package com.example.myproject.jsontest;

import com.alibaba.rocketmq.shade.com.alibaba.fastjson.JSON;
import com.example.myproject.domain.User;

import java.io.IOException;

/**
 * Created by Administrator on 2017/8/8.
 */
public class JsonTest {

    public static void main(String[] args) throws IOException {
        MqSendData mqSendData = new MqSendData();
        User user = null;
        mqSendData.setData(user);
        mqSendData.setTag("23");
        String str = JSON.toJSONString(mqSendData);
        System.out.println("str:" + str);

        MqSendData<User> s2 =  JSON.parseObject(str,MqSendData.class);
        User  ut = (User) s2.getData();
        System.out.println("ut:"+ut.getUsername());
    }

}
